3.3.38 \(\int (c (d \sec (e+f x))^p)^n (a+b \sec (e+f x))^2 \, dx\) [238]

3.3.38.1 Optimal result
3.3.38.2 Mathematica [A] (verified)
3.3.38.3 Rubi [A] (verified)
3.3.38.4 Maple [F]
3.3.38.5 Fricas [F]
3.3.38.6 Sympy [F]
3.3.38.7 Maxima [F]
3.3.38.8 Giac [F]
3.3.38.9 Mupad [F(-1)]

3.3.38.1 Optimal result

Integrand size = 27, antiderivative size = 211 \[ \int \left (c (d \sec (e+f x))^p\right )^n (a+b \sec (e+f x))^2 \, dx=\frac {2 a b \operatorname {Hypergeometric2F1}\left (\frac {1}{2},-\frac {n p}{2},\frac {1}{2} (2-n p),\cos ^2(e+f x)\right ) \left (c (d \sec (e+f x))^p\right )^n \sin (e+f x)}{f n p \sqrt {\sin ^2(e+f x)}}-\frac {\left (b^2 n p+a^2 (1+n p)\right ) \cos (e+f x) \operatorname {Hypergeometric2F1}\left (\frac {1}{2},\frac {1}{2} (1-n p),\frac {1}{2} (3-n p),\cos ^2(e+f x)\right ) \left (c (d \sec (e+f x))^p\right )^n \sin (e+f x)}{f \left (1-n^2 p^2\right ) \sqrt {\sin ^2(e+f x)}}+\frac {b^2 \left (c (d \sec (e+f x))^p\right )^n \tan (e+f x)}{f (1+n p)} \]

output
2*a*b*hypergeom([1/2, -1/2*n*p],[-1/2*n*p+1],cos(f*x+e)^2)*(c*(d*sec(f*x+e 
))^p)^n*sin(f*x+e)/f/n/p/(sin(f*x+e)^2)^(1/2)-(b^2*n*p+a^2*(n*p+1))*cos(f* 
x+e)*hypergeom([1/2, -1/2*n*p+1/2],[-1/2*n*p+3/2],cos(f*x+e)^2)*(c*(d*sec( 
f*x+e))^p)^n*sin(f*x+e)/f/(-n^2*p^2+1)/(sin(f*x+e)^2)^(1/2)+b^2*(c*(d*sec( 
f*x+e))^p)^n*tan(f*x+e)/f/(n*p+1)
 
3.3.38.2 Mathematica [A] (verified)

Time = 0.43 (sec) , antiderivative size = 200, normalized size of antiderivative = 0.95 \[ \int \left (c (d \sec (e+f x))^p\right )^n (a+b \sec (e+f x))^2 \, dx=\frac {\csc (e+f x) \left (a^2 \left (2+3 n p+n^2 p^2\right ) \cos ^2(e+f x) \operatorname {Hypergeometric2F1}\left (\frac {1}{2},\frac {n p}{2},1+\frac {n p}{2},\sec ^2(e+f x)\right )+b n p \left (b (1+n p) \operatorname {Hypergeometric2F1}\left (\frac {1}{2},1+\frac {n p}{2},2+\frac {n p}{2},\sec ^2(e+f x)\right )+2 a (2+n p) \cos (e+f x) \operatorname {Hypergeometric2F1}\left (\frac {1}{2},\frac {1}{2} (1+n p),\frac {1}{2} (3+n p),\sec ^2(e+f x)\right )\right )\right ) \sec (e+f x) \left (c (d \sec (e+f x))^p\right )^n \sqrt {-\tan ^2(e+f x)}}{f n p (1+n p) (2+n p)} \]

input
Integrate[(c*(d*Sec[e + f*x])^p)^n*(a + b*Sec[e + f*x])^2,x]
 
output
(Csc[e + f*x]*(a^2*(2 + 3*n*p + n^2*p^2)*Cos[e + f*x]^2*Hypergeometric2F1[ 
1/2, (n*p)/2, 1 + (n*p)/2, Sec[e + f*x]^2] + b*n*p*(b*(1 + n*p)*Hypergeome 
tric2F1[1/2, 1 + (n*p)/2, 2 + (n*p)/2, Sec[e + f*x]^2] + 2*a*(2 + n*p)*Cos 
[e + f*x]*Hypergeometric2F1[1/2, (1 + n*p)/2, (3 + n*p)/2, Sec[e + f*x]^2] 
))*Sec[e + f*x]*(c*(d*Sec[e + f*x])^p)^n*Sqrt[-Tan[e + f*x]^2])/(f*n*p*(1 
+ n*p)*(2 + n*p))
 
3.3.38.3 Rubi [A] (verified)

Time = 1.01 (sec) , antiderivative size = 227, normalized size of antiderivative = 1.08, number of steps used = 13, number of rules used = 13, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.481, Rules used = {3042, 4436, 3042, 4275, 3042, 4259, 3042, 3122, 4534, 3042, 4259, 3042, 3122}

Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.

\(\displaystyle \int (a+b \sec (e+f x))^2 \left (c (d \sec (e+f x))^p\right )^n \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int (a+b \sec (e+f x))^2 \left (c (d \sec (e+f x))^p\right )^ndx\)

\(\Big \downarrow \) 4436

\(\displaystyle (d \sec (e+f x))^{-n p} \left (c (d \sec (e+f x))^p\right )^n \int (d \sec (e+f x))^{n p} (a+b \sec (e+f x))^2dx\)

\(\Big \downarrow \) 3042

\(\displaystyle (d \sec (e+f x))^{-n p} \left (c (d \sec (e+f x))^p\right )^n \int \left (d \csc \left (e+f x+\frac {\pi }{2}\right )\right )^{n p} \left (a+b \csc \left (e+f x+\frac {\pi }{2}\right )\right )^2dx\)

\(\Big \downarrow \) 4275

\(\displaystyle (d \sec (e+f x))^{-n p} \left (c (d \sec (e+f x))^p\right )^n \left (\int (d \sec (e+f x))^{n p} \left (a^2+b^2 \sec ^2(e+f x)\right )dx+\frac {2 a b \int (d \sec (e+f x))^{n p+1}dx}{d}\right )\)

\(\Big \downarrow \) 3042

\(\displaystyle (d \sec (e+f x))^{-n p} \left (c (d \sec (e+f x))^p\right )^n \left (\int \left (d \csc \left (e+f x+\frac {\pi }{2}\right )\right )^{n p} \left (a^2+b^2 \csc \left (e+f x+\frac {\pi }{2}\right )^2\right )dx+\frac {2 a b \int \left (d \csc \left (e+f x+\frac {\pi }{2}\right )\right )^{n p+1}dx}{d}\right )\)

\(\Big \downarrow \) 4259

\(\displaystyle (d \sec (e+f x))^{-n p} \left (c (d \sec (e+f x))^p\right )^n \left (\int \left (d \csc \left (e+f x+\frac {\pi }{2}\right )\right )^{n p} \left (a^2+b^2 \csc \left (e+f x+\frac {\pi }{2}\right )^2\right )dx+\frac {2 a b \left (\frac {\cos (e+f x)}{d}\right )^{n p} (d \sec (e+f x))^{n p} \int \left (\frac {\cos (e+f x)}{d}\right )^{-n p-1}dx}{d}\right )\)

\(\Big \downarrow \) 3042

\(\displaystyle (d \sec (e+f x))^{-n p} \left (c (d \sec (e+f x))^p\right )^n \left (\int \left (d \csc \left (e+f x+\frac {\pi }{2}\right )\right )^{n p} \left (a^2+b^2 \csc \left (e+f x+\frac {\pi }{2}\right )^2\right )dx+\frac {2 a b \left (\frac {\cos (e+f x)}{d}\right )^{n p} (d \sec (e+f x))^{n p} \int \left (\frac {\sin \left (e+f x+\frac {\pi }{2}\right )}{d}\right )^{-n p-1}dx}{d}\right )\)

\(\Big \downarrow \) 3122

\(\displaystyle (d \sec (e+f x))^{-n p} \left (c (d \sec (e+f x))^p\right )^n \left (\int \left (d \csc \left (e+f x+\frac {\pi }{2}\right )\right )^{n p} \left (a^2+b^2 \csc \left (e+f x+\frac {\pi }{2}\right )^2\right )dx+\frac {2 a b \sin (e+f x) (d \sec (e+f x))^{n p} \operatorname {Hypergeometric2F1}\left (\frac {1}{2},-\frac {n p}{2},\frac {1}{2} (2-n p),\cos ^2(e+f x)\right )}{f n p \sqrt {\sin ^2(e+f x)}}\right )\)

\(\Big \downarrow \) 4534

\(\displaystyle (d \sec (e+f x))^{-n p} \left (c (d \sec (e+f x))^p\right )^n \left (\left (a^2+\frac {b^2 n p}{n p+1}\right ) \int (d \sec (e+f x))^{n p}dx+\frac {2 a b \sin (e+f x) (d \sec (e+f x))^{n p} \operatorname {Hypergeometric2F1}\left (\frac {1}{2},-\frac {n p}{2},\frac {1}{2} (2-n p),\cos ^2(e+f x)\right )}{f n p \sqrt {\sin ^2(e+f x)}}+\frac {b^2 \tan (e+f x) (d \sec (e+f x))^{n p}}{f (n p+1)}\right )\)

\(\Big \downarrow \) 3042

\(\displaystyle (d \sec (e+f x))^{-n p} \left (c (d \sec (e+f x))^p\right )^n \left (\left (a^2+\frac {b^2 n p}{n p+1}\right ) \int \left (d \csc \left (e+f x+\frac {\pi }{2}\right )\right )^{n p}dx+\frac {2 a b \sin (e+f x) (d \sec (e+f x))^{n p} \operatorname {Hypergeometric2F1}\left (\frac {1}{2},-\frac {n p}{2},\frac {1}{2} (2-n p),\cos ^2(e+f x)\right )}{f n p \sqrt {\sin ^2(e+f x)}}+\frac {b^2 \tan (e+f x) (d \sec (e+f x))^{n p}}{f (n p+1)}\right )\)

\(\Big \downarrow \) 4259

\(\displaystyle (d \sec (e+f x))^{-n p} \left (c (d \sec (e+f x))^p\right )^n \left (\left (a^2+\frac {b^2 n p}{n p+1}\right ) \left (\frac {\cos (e+f x)}{d}\right )^{n p} (d \sec (e+f x))^{n p} \int \left (\frac {\cos (e+f x)}{d}\right )^{-n p}dx+\frac {2 a b \sin (e+f x) (d \sec (e+f x))^{n p} \operatorname {Hypergeometric2F1}\left (\frac {1}{2},-\frac {n p}{2},\frac {1}{2} (2-n p),\cos ^2(e+f x)\right )}{f n p \sqrt {\sin ^2(e+f x)}}+\frac {b^2 \tan (e+f x) (d \sec (e+f x))^{n p}}{f (n p+1)}\right )\)

\(\Big \downarrow \) 3042

\(\displaystyle (d \sec (e+f x))^{-n p} \left (c (d \sec (e+f x))^p\right )^n \left (\left (a^2+\frac {b^2 n p}{n p+1}\right ) \left (\frac {\cos (e+f x)}{d}\right )^{n p} (d \sec (e+f x))^{n p} \int \left (\frac {\sin \left (e+f x+\frac {\pi }{2}\right )}{d}\right )^{-n p}dx+\frac {2 a b \sin (e+f x) (d \sec (e+f x))^{n p} \operatorname {Hypergeometric2F1}\left (\frac {1}{2},-\frac {n p}{2},\frac {1}{2} (2-n p),\cos ^2(e+f x)\right )}{f n p \sqrt {\sin ^2(e+f x)}}+\frac {b^2 \tan (e+f x) (d \sec (e+f x))^{n p}}{f (n p+1)}\right )\)

\(\Big \downarrow \) 3122

\(\displaystyle (d \sec (e+f x))^{-n p} \left (c (d \sec (e+f x))^p\right )^n \left (-\frac {d \left (a^2+\frac {b^2 n p}{n p+1}\right ) \sin (e+f x) (d \sec (e+f x))^{n p-1} \operatorname {Hypergeometric2F1}\left (\frac {1}{2},\frac {1}{2} (1-n p),\frac {1}{2} (3-n p),\cos ^2(e+f x)\right )}{f (1-n p) \sqrt {\sin ^2(e+f x)}}+\frac {2 a b \sin (e+f x) (d \sec (e+f x))^{n p} \operatorname {Hypergeometric2F1}\left (\frac {1}{2},-\frac {n p}{2},\frac {1}{2} (2-n p),\cos ^2(e+f x)\right )}{f n p \sqrt {\sin ^2(e+f x)}}+\frac {b^2 \tan (e+f x) (d \sec (e+f x))^{n p}}{f (n p+1)}\right )\)

input
Int[(c*(d*Sec[e + f*x])^p)^n*(a + b*Sec[e + f*x])^2,x]
 
output
((c*(d*Sec[e + f*x])^p)^n*((2*a*b*Hypergeometric2F1[1/2, -1/2*(n*p), (2 - 
n*p)/2, Cos[e + f*x]^2]*(d*Sec[e + f*x])^(n*p)*Sin[e + f*x])/(f*n*p*Sqrt[S 
in[e + f*x]^2]) - (d*(a^2 + (b^2*n*p)/(1 + n*p))*Hypergeometric2F1[1/2, (1 
 - n*p)/2, (3 - n*p)/2, Cos[e + f*x]^2]*(d*Sec[e + f*x])^(-1 + n*p)*Sin[e 
+ f*x])/(f*(1 - n*p)*Sqrt[Sin[e + f*x]^2]) + (b^2*(d*Sec[e + f*x])^(n*p)*T 
an[e + f*x])/(f*(1 + n*p))))/(d*Sec[e + f*x])^(n*p)
 

3.3.38.3.1 Defintions of rubi rules used

rule 3042
Int[u_, x_Symbol] :> Int[DeactivateTrig[u, x], x] /; FunctionOfTrigOfLinear 
Q[u, x]
 

rule 3122
Int[((b_.)*sin[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[Cos[c + d*x]*(( 
b*Sin[c + d*x])^(n + 1)/(b*d*(n + 1)*Sqrt[Cos[c + d*x]^2]))*Hypergeometric2 
F1[1/2, (n + 1)/2, (n + 3)/2, Sin[c + d*x]^2], x] /; FreeQ[{b, c, d, n}, x] 
 &&  !IntegerQ[2*n]
 

rule 4259
Int[(csc[(c_.) + (d_.)*(x_)]*(b_.))^(n_), x_Symbol] :> Simp[(b*Csc[c + d*x] 
)^(n - 1)*((Sin[c + d*x]/b)^(n - 1)   Int[1/(Sin[c + d*x]/b)^n, x]), x] /; 
FreeQ[{b, c, d, n}, x] &&  !IntegerQ[n]
 

rule 4275
Int[(csc[(e_.) + (f_.)*(x_)]*(d_.))^(n_.)*(csc[(e_.) + (f_.)*(x_)]*(b_.) + 
(a_))^2, x_Symbol] :> Simp[2*a*(b/d)   Int[(d*Csc[e + f*x])^(n + 1), x], x] 
 + Int[(d*Csc[e + f*x])^n*(a^2 + b^2*Csc[e + f*x]^2), x] /; FreeQ[{a, b, d, 
 e, f, n}, x]
 

rule 4436
Int[((c_.)*((d_.)*sec[(e_.) + (f_.)*(x_)])^(p_))^(n_)*((a_.) + (b_.)*sec[(e 
_.) + (f_.)*(x_)])^(m_.), x_Symbol] :> Simp[c^IntPart[n]*((c*(d*Sec[e + f*x 
])^p)^FracPart[n]/(d*Sec[e + f*x])^(p*FracPart[n]))   Int[(a + b*Sec[e + f* 
x])^m*(d*Sec[e + f*x])^(n*p), x], x] /; FreeQ[{a, b, c, d, e, f, m, n, p}, 
x] &&  !IntegerQ[n]
 

rule 4534
Int[(csc[(e_.) + (f_.)*(x_)]*(b_.))^(m_.)*(csc[(e_.) + (f_.)*(x_)]^2*(C_.) 
+ (A_)), x_Symbol] :> Simp[(-C)*Cot[e + f*x]*((b*Csc[e + f*x])^m/(f*(m + 1) 
)), x] + Simp[(C*m + A*(m + 1))/(m + 1)   Int[(b*Csc[e + f*x])^m, x], x] /; 
 FreeQ[{b, e, f, A, C, m}, x] && NeQ[C*m + A*(m + 1), 0] &&  !LeQ[m, -1]
 
3.3.38.4 Maple [F]

\[\int \left (c \left (d \sec \left (f x +e \right )\right )^{p}\right )^{n} \left (a +b \sec \left (f x +e \right )\right )^{2}d x\]

input
int((c*(d*sec(f*x+e))^p)^n*(a+b*sec(f*x+e))^2,x)
 
output
int((c*(d*sec(f*x+e))^p)^n*(a+b*sec(f*x+e))^2,x)
 
3.3.38.5 Fricas [F]

\[ \int \left (c (d \sec (e+f x))^p\right )^n (a+b \sec (e+f x))^2 \, dx=\int { {\left (b \sec \left (f x + e\right ) + a\right )}^{2} \left (\left (d \sec \left (f x + e\right )\right )^{p} c\right )^{n} \,d x } \]

input
integrate((c*(d*sec(f*x+e))^p)^n*(a+b*sec(f*x+e))^2,x, algorithm="fricas")
 
output
integral((b^2*sec(f*x + e)^2 + 2*a*b*sec(f*x + e) + a^2)*((d*sec(f*x + e)) 
^p*c)^n, x)
 
3.3.38.6 Sympy [F]

\[ \int \left (c (d \sec (e+f x))^p\right )^n (a+b \sec (e+f x))^2 \, dx=\int \left (c \left (d \sec {\left (e + f x \right )}\right )^{p}\right )^{n} \left (a + b \sec {\left (e + f x \right )}\right )^{2}\, dx \]

input
integrate((c*(d*sec(f*x+e))**p)**n*(a+b*sec(f*x+e))**2,x)
 
output
Integral((c*(d*sec(e + f*x))**p)**n*(a + b*sec(e + f*x))**2, x)
 
3.3.38.7 Maxima [F]

\[ \int \left (c (d \sec (e+f x))^p\right )^n (a+b \sec (e+f x))^2 \, dx=\int { {\left (b \sec \left (f x + e\right ) + a\right )}^{2} \left (\left (d \sec \left (f x + e\right )\right )^{p} c\right )^{n} \,d x } \]

input
integrate((c*(d*sec(f*x+e))^p)^n*(a+b*sec(f*x+e))^2,x, algorithm="maxima")
 
output
integrate((b*sec(f*x + e) + a)^2*((d*sec(f*x + e))^p*c)^n, x)
 
3.3.38.8 Giac [F]

\[ \int \left (c (d \sec (e+f x))^p\right )^n (a+b \sec (e+f x))^2 \, dx=\int { {\left (b \sec \left (f x + e\right ) + a\right )}^{2} \left (\left (d \sec \left (f x + e\right )\right )^{p} c\right )^{n} \,d x } \]

input
integrate((c*(d*sec(f*x+e))^p)^n*(a+b*sec(f*x+e))^2,x, algorithm="giac")
 
output
integrate((b*sec(f*x + e) + a)^2*((d*sec(f*x + e))^p*c)^n, x)
 
3.3.38.9 Mupad [F(-1)]

Timed out. \[ \int \left (c (d \sec (e+f x))^p\right )^n (a+b \sec (e+f x))^2 \, dx=\int {\left (c\,{\left (\frac {d}{\cos \left (e+f\,x\right )}\right )}^p\right )}^n\,{\left (a+\frac {b}{\cos \left (e+f\,x\right )}\right )}^2 \,d x \]

input
int((c*(d/cos(e + f*x))^p)^n*(a + b/cos(e + f*x))^2,x)
 
output
int((c*(d/cos(e + f*x))^p)^n*(a + b/cos(e + f*x))^2, x)